package com.zsummer.demo.design.pattern.behavioral.simplefactory;

/**
 * @author zsummer
 * @since 2022/3/16
 */
public class ProductFactory {

    public static Product createProduct(String productName) {
        if ("A".equals(productName)) {
            return new ProductA();
        }
        if ("B".equals(productName)) {
            return new ProductB();
        }
        throw new RuntimeException("not supported product");
    }
}
